
package com.hh.entity.vo;

import com.hh.entity.domain.User;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author hanhui
 */
@Data
public class UserVO implements Serializable {
    //用户ID
    private Long id;
    //用户ID列表
    private List<Long> ids;
    //用户名
    private String userName;
    //用户账号
    private String userAccount;
    //用户头像URL
    private String avatarUrl;
    //用户性别
    private Integer gender;
    //用户电话
    private String phone;
    //用户邮箱
    private String email;
    //用户状态
    private Integer userStatus;
    //用户角色
    private String userRole;
    //博客总数量
    private Long blogCount;
    //点赞总数量
    private Long likeCount;
    //收藏总数量
    private Long collectCount;
    //关注量
    private Long followCount;
    /**
     * 创建时间
     */
    private Date createTime;

    //对象转VO
    public static UserVO objToVo(User user) {
        if (user == null) {
            return null;
        }
        UserVO userVO = new UserVO();
        BeanUtils.copyProperties(user, userVO);
        return userVO;

    }
    //VO转对象
    public static User voToObj(UserVO userVO) {
        if (userVO == null) {
            return null;
        }
        User user = new User();
        BeanUtils.copyProperties(userVO, user);
        return user;
    }
}
